//
//  OrderTotalPricCell.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/26.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class OrderTotalPricCell: BaseTableViewCell {
    
    @IBOutlet weak var leftLabel: UILabel!
    
    
    @IBOutlet weak var rightLabel: UILabel!
    
    var model : OrderSureDataModel?
    
    var index : IndexPath?{
    
    
        didSet{
            if index == nil {
                return
            }
            
                
            if index?.row == 0 {
                
                leftLabel.text = "总价:"
//                model!.shipping_fee = "2.1"
                let number1 = Float(model!.shipping_fee) ?? 0
                
                if number1 > 0 {
                
                    rightLabel.text = "\(model!.order_amount)元(运费¥\(model!.shipping_fee))"

                }else{
                
                    rightLabel.text = "\(model!.order_amount)元"

                }
                
                rightLabel.textColor = UIColor.red

                
            } else {
                
                leftLabel.text = "还需支付:"
                
                rightLabel.text = "\(model!.needPayMoney)元"
                
                rightLabel.textColor = UIColor.orange

                
                
                
            }
        
        
        }
    
    
    
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        contentView.backgroundColor = UIColor.white
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
